<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .div1:before {
            content: "前面的文字";
            color: red;
            font-size: 20px;
        }

        .div2:after {
            content: "后面的文字";
            color: blue;
            font-size: 25px;
        }
    </style>
</head>

<body>



    <div class="div1">哈哈哈哈哈</div>

    <div class="div2">呵呵呵呵呵</div>


</body>

</html>